import React, { Component } from 'react';
import '../styles/MySecKill.scss'
import * as service from '../api/index'

class MySecKill extends Component {
    constructor(props){
        super(props)
        this.state={
            list:[]
        }
    }
    async componentDidMount(){
        let res=await service.index_goodlist()
        // console.log(res.data.list);
        this.setState({list:res.data.list})
    }
    render() {
        return (
            <div className='seckill'>
                {
                    this.state.list.map((item,index)=>{
                        return (
                            <div className="seckill_item" key={index}>
                                <img src={item.pic} alt="" />
                                <div className="name">{item.name}</div>
                                <span className="ori_price">原价 ￥{item.salesPrice.value}</span>
                                <div className="sec_price">抢购价 ￥<span>{item.salesPrice.value*0.5}</span></div>
                            </div>
                        )
                    })
                }
            </div>
        );
    }
}

export default MySecKill;